/**
 * 
 */
package models;

import java.awt.event.ActionEvent;



/**
 * @author LAP
 *
 */
public class ProgressChangeEvent extends ActionEvent {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7878301738023992696L;
	
	private int maximum;
	
	private int value;
	
	public ProgressChangeEvent(Object source) {
		super(source, 0, null);
		setMaximum(100);
		setValue(0);
	}
	
	public ProgressChangeEvent(Object source, int maximum, int value) {
		super(source, 0, null);
		setMaximum(maximum);
		setValue(value);
	}
	
	public ProgressChangeEvent() {
		this(null);
	}

	/**
	 * @return the maximum
	 */
	public int getMaximum() {
		return maximum;
	}

	/**
	 * @param maximum the maximum to set
	 */
	private void setMaximum(int maximum) {
		if (maximum <= 0) throw new IllegalArgumentException("Maximum must be above 0");
		this.maximum = maximum;
	}

	/**
	 * @return the value
	 */
	public int getValue() {
		return value;
	}

	/**
	 * @param value the value to set
	 */
	private void setValue(int value) {
		if (value < 0) throw new IllegalArgumentException("Value must be above or equal 0");
		this.value = value;
	}
}
